package com.zhc.dejingapi.utils;

import com.zhc.dejingapi.pojo.pub.CodeNameModel;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class PubInfoUtils {
    public  static Map<String,String> mapMakeList=null;
    public static void  LoadMakeList(JdbcTemplate mysqlJdbcTemplate)
    {
        mapMakeList=new HashMap<>();
        String strSql="select CODE as code,NAME as name from bommake ";

        //List<CodeNameModel> list=mysqlJdbcTemplate.query(strSql,new CodeNameModel());
        List<CodeNameModel>  listFields=mysqlJdbcTemplate.query(strSql,new BeanPropertyRowMapper<>(CodeNameModel.class));
        if(listFields==null||listFields.isEmpty()){

        }
        else{
            for (CodeNameModel item:listFields){
                mapMakeList.put(item.getCode(),item.getName());
            }
        }
    }
}
